﻿using System.Web.Mvc;

namespace Mozlite.WebUI.Mvc4.Backend
{
    /// <summary>
    /// 区域路由注册类。
    /// </summary>
    public class BackendAreaRegistration : AreaRegistration
    {
        /// <summary>
        /// 区域名称。
        /// </summary>
        public override string AreaName
        {
            get
            {
                return Consts.Backend;
            }
        }
        /// <summary>
        /// 区域注册方法。
        /// </summary>
        /// <param name="context">区域注册上下文。</param>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            //错误提示
            context.Register(
                "AccessError",
                Cores.Backend + "/Message",
                new { controller = "home", action = "Message", id = UrlParameter.Optional }
            );
            //用户中心
            context.Register(
                "ucenter",
                "ucenter/{action}/{id}",
                new { controller = "ucenter", action = "Index", id = UrlParameter.Optional }
            );
            //注册HomeController
            context.Register(
                "home",
                "~/{action}",
                new { controller = "home", action = "Index"}
            );
            //默认路由
            context.Register(
                "default",
                "~/{controller}/{action}/{id}",
                new {action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
